// 代码高亮启动

$(function () {
    hljs.highlightAll();
    $("#comment-btn").on('click', function (event) {
        event.preventDefault()
        let user_id = $(this).data('user-id');
        if (!user_id || user_id == "") {
            window.location = '/login'
            return
        }
        let content = $("#comment-textarea").val();
        let post_id = $(this).data('post-id');
        zlajax.post({
            url: '/comment',
            data: {
                'content': content,
                'post_id': post_id
            },
            success: function (data) {
                if (data['code'] == 200) {
                    window.location.reload()
                } else {
                    alert(data['message'])
                }
            }
        })


    })
})